
const Mock = require('mockjs');

// 配置拦截 ajax 的请求时的行为，支持的配置项目有 timeout。
 Mock.setup({
    timeout: '200 - 400'
})

const userInfo = require('./userinfo.json')
const menu = require('./menu.json')

function initCaptcha (prarms) {
    return {"success":true,"message":"success","code":200,"timestamp":1567754363690,"result":"a371e90e24e0490ba6facdf356209d0d"};
}

function loginFun (prarms) {
    return {"result":"7178fbb8aecf4034b5dfd71869e125e5","code":200,"success":true,"message":"登录成功","timestamp":1567756119750}
}

function userInfoFun(params){
    return userInfo
}

function menuFun(params){
    return menu
}
 
// Mock.mock( url, post/get , 返回的数据)；
Mock.mock('/xboot/common\/captcha\/init', 'get', initCaptcha); // 获取验证码
Mock.mock('/xboot/login', 'post', loginFun); //登录
Mock.mock('/xboot/user/info', 'get', userInfoFun);
Mock.mock('/xboot/permission/getMenuList', 'get', menuFun);